home *** CD-ROM | disk | FTP | other *** search
- #include "UtilsSys7.h"
-
- #include "FabWmemman.h"
- #include "FabACursors.h"
-
- struct fcur {
- short firstFrameID;
- short lastFrameID;
- };
-
- typedef struct fcur fcur, *fcurPtr, **fcurHandle;
-
- static CursHandle *gCursors = nil;
- unsigned int gCursorChanges = 0;
- static short gHowMany = 0;
- Boolean gCanInitCursor = true;
-
- #if !defined(FabNoSegmentDirectives)
- #pragma segment Init
- #endif
-
- OSErr FabLoadCursors(short fCurResID)
- {
- fcurHandle cResH;
- CursHandle tempC;
- short first, last, i;
- OSErr err = noErr;
-
- if (gCursors == nil) {
- cResH = (fcurHandle)Get1Resource('fCur', fCurResID);
- if (cResH) {
- first = (*cResH)->firstFrameID;
- last = (*cResH)->lastFrameID;
- gHowMany = last - first;
- gCursors = fmalloc((gHowMany + 1) * sizeof(CursHandle));
- for (i = first; i <= last; i++) {
- // for (i = 0; i <= gHowMany; i++)
- tempC = GetCursor(i);
- // tempC = GetCursor(i + first);
- if (tempC == nil) {
- FabFreeCursors();
- break;
- }
- gCursors[i - first] = tempC;
- // gCursors[i] = tempC;
- }
- }
- else
- err = ResError();
- }
- return err;
- }
-
- #if !defined(FabNoSegmentDirectives)
- #pragma segment Main
- #endif
-
- void FabRotateCursor(void)
- {
- static UInt32 oldtick = 0;
- static int indx = 0;
- UInt32 tick = TickCount();
-
- if ((tick - oldtick) > 30UL /*&& LMGetCrsrBusy() == false*/) {
- indx++;
- indx &= gHowMany;
- SetCursor(*gCursors[indx]);
- gCursorChanges++;
- oldtick = tick;
- gCanInitCursor = false;
- }
- }
-
- void FabFreeCursors(void)
- {
- if (gCursors) {
- SAFEDESTROY(ffree, CursHandle *, gCursors, CursHandle *)
- gHowMany = 0;
- }
- }
-
-